<?php
include '../../../Smarty/Smarty.php';
require Yii::getPathOfAlias('common.extensions.SexyTemplate') . '.php';

class LoginController extends controller
{
    private $perPage = 5;

    public function __construct()
    {
        $this->cache_time = 0;

    }

    public function index()
    {
        $this->display('login.html');
    }

    public function loginHandler(){
        $userName = Yii::app()->request->getParam('userName');
        $password = Yii::app()->request->getParam('password');
        if($userName != 'xianzhi'){
            $this->ajaxTip(0,'账号错误！');
        }
        if($password != '123456'){
            $this->ajaxTip(0,'密码错误！');
        }
        //设置cookie
        if(setcookie('xzAdmin',md5($userName.md5(date('ymd'))))){
            $this->ajaxTip(1);
        }else{
            $this->ajaxTip(0,'登录失败！');
        }
    }



}


$controller = new LoginController();
$action = isset($_GET['a']) ? trim($_GET['a']) : 'index';
$controller->$action();
